<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>11111111111111111</li>
        <li>22222222222222222</li>
        <li>333333333333333333</li>
    </ul>
</body>
<script>
    var li = document.getElementsByTagName('li');
    for(var i = 0;i<li.length; i++){
        (function(i){
            li[i].addEventListener('click',function(){
                console.log(i+1);
            },false)
        }(i))
    
         
    }
</script>
</html>